# ======================================================= # Stop USB devices when my screen is off to help save battery # (Equivalent to USB Selective Suspend) # ======================================================= $RegPath = "HKLM:\SYSTEM\CurrentControlSet\Control\USB\AutomaticSurpriseRemoval" $Name = "AttemptRecoveryFromUsbPowerDrain" $Value = 1 # 1 = Enabled, 0 = Disabled (Default is 1) if (-not (Test-Path $RegPath)) { Write-Host "Creating Registry Path: $RegPath" New-Item -Path $RegPath -Force | Out-Null } Set-ItemProperty -Path $RegPath -Name $Name -Value $Value -Type DWord -Force